# Maintainer: Christian Franke <nobody@nowhere.ws>
pkgname=rtrlib
pkgver=0.7.0
pkgrel=2
pkgdesc="An open-source C implementation of the RPKI/Router Protocol client"
url="https://github.com/rtrlib/rtrlib"
arch="all"
license="MIT"
makedepends="cmake cmocka-dev doxygen graphviz libssh-dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rtrlib/rtrlib/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		"$CMAKE_CROSSOPTS"
	make -C build
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="e1c78ce92d066308c1c4fbb6575c2f0dc0f6840c16be90e27bd0da184cab7d0fa4dd1cff3677eda5f1720184756e02765e5abd267b0da0d183082721fee2ffd8  rtrlib-0.7.0.tar.gz"
